package java学习.第10章_多线程的入门;

public class C_Runnable {
    public static void main(String[] args) {
        MyRunnable mr = new MyRunnable();
        //    多线程运行的代码  线程名字
        new Thread(mr,"线程001").start();
        MyRunnable.s();
        System.out.println("C_Runnable");
    }
}

/**
 * 创建线程 2
 *      Thread 也是继承了 Runnable 接口
 */
class MyRunnable implements Runnable{

    public static void s(){
        for (int i = 0; i < 100; i++) {
            if ((i & 15) == 0){
                System.out.println(Thread.currentThread().getName() +
                        ":\t" + i);
            }
        }
    }
    @Override
    public void run() {
        s();
    }
}

